//
//  TopicTableViewCell.m
//  TextApplication
//
//  Created by dllo on 16/8/30.
//  Copyright © 2016年 yh. All rights reserved.
//

#import "TopicTableViewCell.h"
#import "TAMacro.h"
#import "ClassItems.h"
#import "UIImageView+WebCache.h"

@interface TopicTableViewCell ()
@property (nonatomic, strong) UIImageView *picImageView;
@property (nonatomic, strong) UILabel *titleLabel;
@end

@implementation TopicTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _picImageView = [[UIImageView alloc] init];
        _titleLabel = [[UILabel alloc] init];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _picImageView.frame = CGRectMake(0, 0, self.contentView.bounds.size.width, self.contentView.bounds.size.height);
    [self addSubview:self.picImageView];
    
    _titleLabel.frame = CGRectMake(0, self.contentView.bounds.size.height / 2 - 15, self.contentView.bounds.size.width, 30);
    _titleLabel.textAlignment = 1;
    _titleLabel.font = [UIFont systemFontOfSize:13];
    _titleLabel.textColor = [UIColor whiteColor];
    [self addSubview:self.titleLabel];
}

- (void)setData:(ClassItems *)data {
    _data = data;
    [_picImageView sd_setImageWithURL:[NSURL URLWithString:self.data.cover_img]];
    _titleLabel.text = self.data.topic_name;
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
